// 用户相关的接口函数
import request from '@/utils/http.js'

//登录接口
export const loginAPI= (data) => {
    return request({
        url:'user/login',
        method:'post',
        data:{
            account:data.account,
            password:data.password,
            userRole: data.role,
        }
    })
}

//注册接口
export const registerAPI= (data) => {
    return request({
        url: 'user/register',
        method: 'post',
        data: {
            userName: data.username,
            account: data.account,
            password: data.password,
            confirmPassword: data.confirmPassword,
            userRole: data.role,
        }
    })
}

// 退出登录接口
export const loginOutAPI = (data) => {
    return request({
        url: 'user/logout',
        method: 'post',
        data: {
            account: data.account,
            userRole: data.userRole,
        }
    })
}

// 获取用户信息接口
export const queryUserByIdAPI= (userId) => {
    return request({
        url:'user/queryUserById',
        method:'post',
        params:{userId}
    })
}

// 修改用户状态
export const updateUserStatusByIdAPI= (userId, userStatus) => {
    return request({
        url:'user/updateUserById',
        method:'post',
        data:{
            userId: userId,
            userStatus:userStatus,
        }
    })
}

// 修改用户状态-学生接口
export const updateUserAndStudentByIdAPI= (studentId,studentUserId, userStatus) => {
return request({
    url:'user/updateUserAndStudentById',
    method:'post',
    params:{
        studentId: studentId,
        studentUserId: studentUserId,
        userStatus:userStatus,
    }
})
}

// 修改用户状态-企业接口
export const updateUserAndEnterpriseByIdAPI= (enterpriseId,enterpriseUserId, userStatus) => {
return request({
    url:'user/updateUserAndEnterpriseById',
    method:'post',
    params:{
        enterpriseId: enterpriseId,
        enterpriseUserId: enterpriseUserId,
        userStatus:userStatus,
    }
})
}

//根据用户ID查询学生信息
export const queryStudentByUserIdAPI = (userId) => {
    return request({
        url: '/user/queryStudentByUserId',
        method: 'post',
        params: {userId}
    })
}
//查询审核视频状态在审核中的数量
export const queryVideoStatusCount = (videoCertificationStatus) => {
    return request({
        url: '/user/queryVideoStatusCount',
        method: 'post',
        params: {
            videoCertificationStatus:videoCertificationStatus
        }
    })
}
//查询审核企业状态在审核中的数量
export const queryEnterpriseStatusCount = (enterpriseCertificationStatus) => {
    return request({
        url: '/user/queryEnterpriseStatusCount',
        method: 'post',
        params: {
            enterpriseCertificationStatus:enterpriseCertificationStatus
        }
    })
}

//查询审核反馈举报状态在审核中的数量
export const queryReportStatusCount = (reportCheckStatus) => {
    return request({
        url: '/user/queryReportStatusCount',
        method: 'post',
        params: {
            reportCheckStatus:reportCheckStatus
        }
    })
}
//分页查询用户信息
export const pageUserAPI = (data) => {
    return request({
        url: '/user/pageUser',
        method: 'post',
        data: {
            userRole: data.userRole,
            userStatus: data.userStatus,
            searchName: data.searchName,
        }
    })
}

//用户上传头像
export const userUploadAvatarAPI = (userId, imageUrl) => {
    return request({
        url: '/user/userUploadAvatar',
        method: 'post',
        params: {
            userId: userId,
            imageUrl: imageUrl
        }
    })
}

//修改用户信息
export const updateUserByIdAPI = (data) => {
    return request({
        url: '/user/updateUserById',
        method: 'post',
        data:{
            userId: data.userId,
            userName: data.userName,
            userAvatarUrl: data.userAvatarUrl,
        }
    })
}

//重置密码
export const resetPasswordAPI = (userId, password) => {
    return request({
        url: '/user/resetPassword',
        method: 'post',
        params: {
            userId: userId,
            password: password
        }
    })
}